<?php
namespace app\dsadmin\model;
use think\Model;

class LogModel extends Model
{
    protected $name = 'log';

    /**
     * 删除日志
     */
    public function delLog($log_id)
    {
        try
        {
            $this->where('log_id', $log_id)->delete();
            return ['code' => 1, 'data' => '', 'msg' => '删除日志成功'];
        }
        catch(PDOException $e)
        {
            return ['code' => 0, 'data' => '', 'msg' => $e->getMessage()];
        }
    }
    public function delAllLog()
    {
        try
        {
            $this->where(['log_id' => ['<>', 0]])->delete();
            $this->execute("truncate table ds_log");
            return ['code' => 1, 'data' => '', 'msg' => '删除日志成功'];
        }
        catch(PDOException $e)
        {
            return ['code' => 0, 'data' => '', 'msg' => $e->getMessage()];
        }
    }
}
